<template>
    <view class="navigation">
        <view class="content-img">
            <eui-nav-bar ref="BcmNavBar" title="门店商品" :storeName="sUserStoreName" :storeId="sUserStore"
                @onClickStore="clickStore" color="#333" backgroundColor="white" @onClickRefresh="onClickRefresh" />
            <view class="container flex just-between align-center">
                <eui-search-bar v-model="searchValue" @confirm="searchConfirm" radius="100" leftIcon="icon-saoyisao"
                    placeholder="商品编码/条码/商品名称(模糊)" @clear="clearSearch" @clickLeftIcon="clickScanLeft" :focus="true"
                    style="flex: 6">
                </eui-search-bar>
                <eui-dropdownsearch v-model:menuList="dropDownData" :themeColor="themeColor" :duration="300"
                    :isCeiling="true" @onConfirm="onConfirm" style="height:80rpx;flex: 1">
                </eui-dropdownsearch>
            </view>
        </view>
        <view class="footer-view">
            <scroll-view :scroll-y="true" style="width: 140rpx;background-color: #F2F2F2;font-size: 24rpx;">
                <next-tree ref="qiantree" :selectParent="false" labelKey="cateName" valueKey="cateCode"
                    :multiple="false" :treeData="cateTreeData" v-if="cateTreeData.length" @click="selectItem" />
            </scroll-view>
            <eui-virtual-list @onRefresh="listPullDown" @lower="listPullUp" refresher="true" isBottom="true"
                :origList="orderList" type="list" :showHeard="false" style="flex: 1;">
                <template v-slot:title>
                    <view class="co-8e text-right"
                        style="font-size: 28rpx;margin-right: 28rpx;height: 50rpx;line-height: 50rpx;" v-if="cateName">
                        {{ cateName }}({{ RowsCount }})</view>
                </template>
                <template v-slot:list="scope">
                    <GoodsItem :scope="scope" :chnlTypeList="chnlTypeList" :onlineSaleStatusList="onlineSaleStatusList"
                        :stockoutStatusList="stockoutStatusList" />
                </template>
                <template v-slot:bottom="scope">
                    <view class="flex just-around" style="flex:1;">
                        <eui-button :modelValue="scope" title="更多" type="max2" single-tag="more"
                            @buttonClick="buttonClick" class="margin"></eui-button>
                        <eui-button :modelValue="scope" title="上下架" type="max2"
                            :disabled="!formatShopGoodsPublishList(scope)?.length" single-tag="shelves"
                            @buttonClick="buttonClick" class="margin"></eui-button>
                        <eui-button :modelValue="scope" title="改价格" type="max2" single-tag="modifyPrice"
                            @buttonClick="buttonClick" class="margin"></eui-button>
                        <eui-button :modelValue="scope" title="改库存" type="max2" @buttonClick="buttonClick"
                            single-tag="modifyStock" class="margin"></eui-button>

                    </view>
                </template>
            </eui-virtual-list>

            <!-- 上下架 -->
            <eui-popup ref="shelvesPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 60vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            上下架
                        </view>
                        <bcm-close-btn @click="close"></bcm-close-btn>
                    </view>
                    <view style="flex:1;margin-top: 20rpx;">
                        <GoodsItem :scope="currentItem" :chnlTypeList="chnlTypeList"
                            :onlineSaleStatusList="onlineSaleStatusList" :stockoutStatusList="stockoutStatusList"
                            v-if="!!currentItem" type="2" />
                        <view style="border-top: 1rpx solid #E0E0E0;padding-top: 16rpx;">
                            <view style="font-size: 28rpx;margin-left: 180rpx;">
                                <view class="co-8e flex align-center">
                                    <text style="margin-right: 8rpx;"> 设置方式:</text>
                                    <view
                                        :style="{ 'width': '180rpx', 'height': '58rpx', 'background': shelvesType == '1' ? 'linear-gradient( 156deg, #4FE0EA 0%, #85B6FD 100%)' : 'linear-gradient( 156deg, #E4E4E4 0%, #B8B8B8 100%)', 'border-radius': '30rpx' }"
                                        class="flex align-center just-between" @click="changeType">
                                        <view
                                            style="width: 50rpx;height: 50rpx;background-color: #fff;margin:2rpx 4rpx 2rpx 2rpx;border-radius: 50rpx;"
                                            v-if="shelvesType == '1'">
                                        </view>
                                        <view style="flex:1;font-size: 26rpx;color: #fff;text-align: center;">
                                            {{ shelvesType == '1' ? '按渠道' : '全部渠道' }}
                                        </view>
                                        <view
                                            style="width: 50rpx;height: 50rpx;background-color: #fff;margin:2rpx 2rpx 2rpx 8rpx;border-radius: 50rpx;"
                                            v-if="shelvesType == '0'">
                                        </view>
                                    </view>
                                </view>
                                <view class="co-8e flex align-center" style="margin-top: 20rpx" v-if="shelvesType == '0'">
                                    <text style="margin-right: 8rpx;">上下架状态:</text>
                                    <radio-group @change="radioChange" class="flex co-00">
                                        <label v-for="(item, index) in shelvesStatusList" :key="index"
                                            style="margin-right: 30rpx">
                                            <radio :value="item.value"
                                                v-bind:checked="shelvesStatusValue == item.value ? true : false" />
                                            {{ item.text }}
                                        </label>
                                    </radio-group>
                                </view>
                                <view class="co-8e" style="margin-top: 20rpx" v-else>
                                    <view v-for="(item, index) in formatShopGoodsPublishList(currentItem)" :key="index"
                                        class="co-8e flex align-center" style="margin-bottom: 20rpx;">
                                        <text style="margin-right: 8rpx;min-width: 120rpx;"
                                            class="text-right">{{ item.chnlName }}:</text>
                                        <radio-group @change="chnlRadioChange" class="flex co-00"
                                            :data-chnltype="item.chnlType">
                                            <label v-for="(a, index) in shelvesStatusList" :key="index"
                                                style="margin-right: 30rpx">
                                                <radio :value="a.value"
                                                    v-bind:checked="chnlShelvesStatusValue[item.chnlType] == a.value ? true : false" />
                                                {{ a.text }}
                                            </label>
                                        </radio-group>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="bottom-1">
                    <eui-button type="max" title="确定" style="width: 80%;height: 100%;line-height: 78rpx;padding: 0;"
                        singleTag="shelvesConfirm" :modelValue="currentItem" @buttonClick="buttonClick" />
                </view>
            </eui-popup>
            <!-- 更多操作 -->
            <eui-popup ref="moreActionPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 50vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            更多操作
                        </view>
                        <bcm-close-btn @click="close"></bcm-close-btn>
                    </view>
                    <view style="flex:1;">
                        <view class="more-btn" @click="handleSyncOperate('1')">同步库存到渠道</view>
                        <view class="more-btn" @click="handleSyncOperate('2')">同步价格到渠道</view>
                        <view class="more-btn" @click="handleSyncOperate('3')">同步上下架状态到渠道</view>
                        <view class="more-btn" @click="handleOnPriceClick">{{ currentItem?.isReceivePrice == '0' ? '接价格'
                            : '停价格'}}
                        </view>
                        <view class="more-btn" @click="handleOnStockClick">{{ currentItem?.isReceiveStock == '0' ? '接库存'
                            : '停库存'}}
                        </view>
                    </view>
                </view>
            </eui-popup>

            <!-- 改库存 -->
            <eui-popup ref="modifyStockPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 70vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            修改库存
                        </view>
                        <bcm-close-btn @click="close"></bcm-close-btn>
                    </view>
                    <view style="flex:1;margin-top: 20rpx;">
                        <GoodsItem :scope="currentItem" :chnlTypeList="chnlTypeList"
                            :onlineSaleStatusList="onlineSaleStatusList" :stockoutStatusList="stockoutStatusList"
                            v-if="!!currentItem" type="3" @toLog="toLog" />
                        <view style="border-top: 1rpx solid #E0E0E0;padding-top: 16rpx;">
                            <view style="font-size: 28rpx;margin-left: 180rpx;">
                                <view class="co-8e flex align-center" style="margin-bottom: 10rpx;">
                                    <text style="margin-right: 20rpx;">库存状态:</text>
                                    <radio-group @change="stockStatusRadioChange" class="flex co-00">
                                        <label v-for="(item, index) in isReceiveStockList" :key="index"
                                            style="margin-right: 30rpx">
                                            <radio :value="item.value"
                                                v-bind:checked="isReceiveStockValue == item.value ? true : false" />
                                            {{ item.text }}
                                        </label>
                                    </radio-group>
                                </view>
                                <view class="co-8e flex align-center" style="margin-top: 10rpx;"
                                    v-if="currentItem?.specMode != '2' && isReceiveStockValue == '0' && currentItem?.stockoutStatus != '1'">
                                    <text style="margin-right: 8rpx;">中台库存:</text>
                                    <view class="flex align-center" style="font-size: 32rpx;">
                                        <eui-uicons type="minus-filled" size="60"
                                            :style="{ 'color': (!currentItem?.stock1 || currentItem?.stock1 < 0) ? '#D8D8D8 !important' : '#85B6FD !important' }"
                                            @click="minusNum()"></eui-uicons>
                                        <view style="color: #626262;width: 100rpx;" class="text-center">
                                            {{ currentItem?.stock1 }}
                                        </view>
                                        <eui-uicons type="plus-filled" size="60"
                                            :style="{ 'color': '#85B6FD !important' }" @click="plusNum()"></eui-uicons>
                                    </view>
                                </view>
                            </view>
                            <view style="overflow-y: scroll;padding: 0 10rpx;box-sizing: border-box;"
                                v-if="currentItem?.specMode == '2' && isReceiveStockValue == '0' && currentItem?.stockoutStatus != '1'">
                                <view v-if="!!currentItem.specAttrs && typeof (currentItem.specAttrs) == 'string'"
                                    class='flex co-8e'>
                                    <view class='flex' style="flex: 2">
                                        <view v-for="spec in JSON.parse(currentItem.specAttrs)" style="flex:1">
                                            {{ spec.name }}
                                        </view>
                                    </view>
                                    <view style="flex:2">编码/条码</view>
                                    <view style="flex:1">中台库存</view>
                                </view>
                                <scroll-view scroll-y="true" style="font-size: 24rpx;margin-top: 10rpx;height: 25vh">
                                    <view>
                                        <view v-for="(a, c) in currentItem.goodsSkuList" class='flex align-center'
                                            :key="c" style="margin-bottom: 10rpx">
                                            <view class='flex' style="flex: 2">
                                                <view v-for="b in a.skuName?.split('-')" style="flex:1">{{ b }}</view>
                                            </view>
                                            <view style="flex: 2;line-height: 25rpx">
                                                <view>{{ a.goodsCode }}</view>
                                                <view>{{ a.goodsBarcode }}</view>
                                            </view>
                                            <view class="flex align-center" style="font-size: 32rpx;">
                                                <eui-uicons type="minus-filled" size="50"
                                                    :style="{ 'color': (!a?.stock1 || a?.stock1 < 0) ? '#D8D8D8 !important' : '#85B6FD !important' }"
                                                    @click="minusStockNum(c)"></eui-uicons>
                                                <view style="color: #626262;width: 80rpx;" class="text-center">
                                                    {{ a?.stock1 || 0 }}
                                                </view>
                                                <eui-uicons type="plus-filled" size="50"
                                                    :style="{ 'color': '#85B6FD !important' }"
                                                    @click="plusStockNum(c)"></eui-uicons>
                                            </view>
                                        </view>
                                    </view>
                                </scroll-view>
                            </view>
                        </view>
                    </view>
                    <view class="bottom-1">
                        <eui-button type="max" title="确定" style="width: 80%;height: 100%;line-height: 78rpx;padding: 0;"
                            @buttonClick="stockUpdateConfirm" />
                    </view>
                </view>
            </eui-popup>

            <!-- 请选择规格 -->
            <eui-popup ref="chooseSkuPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 70vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            请选择规格
                        </view>
                        <bcm-close-btn @click="closeSkuPop"></bcm-close-btn>
                    </view>
                    <view style="flex:1;margin-top: 20rpx;">
                        <GoodsItem :scope="currentItem" :chnlTypeList="chnlTypeList"
                            :onlineSaleStatusList="onlineSaleStatusList" :stockoutStatusList="stockoutStatusList"
                            v-if="!!currentItem" type="3" :showLog="false" />
                        <view style="border-top: 1rpx solid #E0E0E0;padding-top: 16rpx;">
                            <view style="padding: 0 10rpx;box-sizing: border-box;">
                                <view v-if="!!currentItem.specAttrs && typeof (currentItem.specAttrs) == 'string'"
                                    class='flex co-8e'>
                                    <view class='flex' style="flex: 3">
                                        <view v-for="spec in JSON.parse(currentItem.specAttrs)" style="flex:1">
                                            {{ spec.name }}
                                        </view>
                                    </view>
                                    <view style="flex:2">编码/条码</view>
                                    <view>中台库存</view>
                                </view>
                                <scroll-view scroll-y="true" style="font-size: 24rpx;margin-top: 10rpx;height: 30vh">
                                    <view>
                                        <view v-for="(a, c) in currentItem.goodsSkuList" class='flex align-center'
                                            :key="c" style="margin-bottom: 10rpx">
                                            <view class='flex' style="flex: 3">
                                                <view v-for="b in a.skuName?.split('-')" style="flex:1">{{ b }}</view>
                                            </view>
                                            <view style="flex: 2;line-height: 25rpx">
                                                <view>{{ a.goodsCode }}</view>
                                                <view>{{ a.goodsBarcode }}</view>
                                            </view>
                                            <view class="flex align-center" style="font-size: 28rpx;color:#5481FF;"
                                                @click="toSkuStockLog(a)">
                                                查看日志
                                            </view>
                                        </view>
                                    </view>
                                </scroll-view>
                            </view>
                        </view>
                    </view>
                </view>
            </eui-popup>

            <!-- 库存日志 -->
            <eui-popup ref="stockLogPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 70vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            库存日志
                        </view>
                        <bcm-close-btn @click="closeLog"></bcm-close-btn>
                    </view>
                    <scroll-view scroll-y="true" style="flex:1;margin-top: 20rpx;overflow-y: scroll;">
                        <GoodsItem :scope="currentSkuItem" :chnlTypeList="chnlTypeList"
                            :onlineSaleStatusList="onlineSaleStatusList" :stockoutStatusList="stockoutStatusList"
                            v-if="!!currentSkuItem" type="5" />
                        <view style="border-top: 1rpx solid #E0E0E0;padding-top: 16rpx;">
                            <view style="padding: 0 10rpx;">
                                <view class="flex co-8e" style="font-size: 26rpx;margin-bottom: 10rpx;">
                                    <view style="flex:1">操作人/操作时间</view>
                                    <view style="flex:1;margin-left: 20rpx;">中台/预留/在途</view>
                                    <view style="width: 300rpx">触发方式/备注</view>
                                </view>
                                <view v-for="(item, index) in stockLogList" :key="index"
                                    style="font-size: 20rpx;align-items:center;margin-bottom: 10rpx;" class="flex"
                                    @click="toChnlLog(item.syncId)">
                                    <view style="flex:1">
                                        <view>{{ item.createBy }}</view>
                                        <view>{{ item.createTime }}</view>
                                    </view>
                                    <view style="flex:1;margin-left: 20rpx;">
                                        <text>{{ item.stock }}</text>
                                        <text>/{{ item.reservedStock }}/</text>
                                        <text>{{ item.standByStock }}</text>
                                    </view>
                                    <view style="width: 300rpx">
                                        <view>{{ getBcmDictName('stockTriggerMode', item.stockTriggerMode) }}</view>
                                        <view>{{ item.remark }}</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </scroll-view>
                </view>
            </eui-popup>

            <!-- 渠道同步日志 -->
            <eui-popup ref="stockSyncLogPop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 50vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            渠道同步日志
                        </view>
                        <bcm-close-btn @click="closeSyncLog"></bcm-close-btn>
                    </view>
                    <scroll-view scroll-y="true" style="flex:1;margin-top: 20rpx;overflow-y: scroll;">
                        <view style="">
                            <view style="padding: 0 10rpx;">
                                <view class="flex co-8e" style="font-size: 26rpx;margin-bottom: 10rpx;">
                                    <view style="flex:2">渠道</view>
                                    <view style="flex:1;margin-left: 20rpx;">库存</view>
                                    <view style="width: 300rpx">结果</view>
                                </view>
                                <view v-for="(item, index) in chnlStockLogList" :key="index"
                                    style="font-size: 24rpx;align-items:center;margin-bottom: 10rpx;" class="flex">
                                    <view style="flex:2">
                                        <view style="width: 160rpx;">
                                            <view class="chnltype"
                                                :style="{ backgroundColor: getColor(item.chnlType), 'font-size': '28rpx', color: getColor(item.chnlType) ? '#fff' : '#000' }">
                                                {{ getBcmDictName('chnlType', item.chnlType) }}
                                            </view>
                                        </view>
                                        <view>{{ item.createTime }}</view>
                                    </view>
                                    <view style="flex:1;margin-left: 20rpx;">
                                        <text>{{ item.stock }}</text>
                                    </view>
                                    <view style="width: 300rpx">
                                        <eui-status :type="item.chnlSyncStatus == '3' ? 'error' : 'success'"
                                            :title="getBcmDictName('chnlSyncStatus', item.chnlSyncStatus)" />
                                        <view
                                            :style="{ 'color': item.chnlSyncStatus == '3' ? '#FF4000' : '', 'margin-top': '4rpx' }"
                                            v-if="item.chnlSyncStatus == '3'">{{ item.syncMessage }}</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </scroll-view>
                </view>
            </eui-popup>

            <!-- 改价格 -->
            <eui-popup ref="modifyPricePop" background-color="#fff" type="bottom" :mask-click="false">
                <view class="popup-content" style="height: 70vh">
                    <view class="popup-title flex just-between">
                        <view style="font-weight: bold;">
                            修改价格
                        </view>
                        <bcm-close-btn @click="close"></bcm-close-btn>
                    </view>
                    <view style="flex:1;margin-top: 20rpx;">
                        <GoodsItem :scope="currentItem" :chnlTypeList="chnlTypeList"
                            :onlineSaleStatusList="onlineSaleStatusList" :stockoutStatusList="stockoutStatusList"
                            v-if="!!currentItem" type="4" />
                        <view style="border-top: 1rpx solid #E0E0E0;padding-top: 16rpx;">
                            <view style="font-size: 28rpx;margin-left: 180rpx;">
                                <view class="co-8e flex align-center" style="margin-bottom: 10rpx;">
                                    <text style="margin-right: 20rpx;">价格状态:</text>
                                    <radio-group @change="priceStatusRadioChange" class="flex co-00">
                                        <label v-for="(item, index) in isReceivePriceList" :key="index"
                                            style="margin-right: 30rpx">
                                            <radio :value="item.value"
                                                v-bind:checked="isReceivePriceValue == item.value ? true : false" />
                                            {{ item.text }}
                                        </label>
                                    </radio-group>
                                </view>
                                <view class="co-8e flex align-center" style="margin-top: 20rpx;"
                                    v-if="!!currentItem && currentItem?.specMode != '2' && isReceivePriceValue == '0'">
                                    <text style="margin-right: 8rpx;">门店价:</text>
                                    <view class="flex align-center" style="font-size: 32rpx;box-sizing: border-box">
                                        <view
                                            style="width: 210rpx;height: 53rpx;margin-left:6rpx;background-color: #fff;box-sizing: border-box;border-radius: 10rpx;border: 1rpx solid #363636;color: #333"
                                            class="flex align-center">
                                            <view
                                                style="width: 80rpx;height: 50rpx;line-height: 50rpx;border-right: 1rpx solid #333;background: #EEEEEE;border-radius: 10rpx 0rpx 0rpx 10rpx;margin-right: 4rpx;"
                                                class="text-center">¥</view>
                                            <input placeholder="请输入" placeholder-style="color:#363636;font-size: 32rpx;"
                                                type="number" v-model="currentItem.storePriceNew"
                                                style="padding: 2rpx 0 2rpx 6rpx;" />
                                        </view>
                                    </view>
                                </view>
                                <view class="co-8e flex align-center" style="margin-top: 20rpx;"
                                    v-if="!!currentItem && currentItem?.specMode != '2' && isReceivePriceValue == '0'">
                                    <text style="margin-right: 8rpx;">会员价:</text>
                                    <view class="flex align-center" style="font-size: 32rpx;box-sizing: border-box">
                                        <view
                                            style="width: 210rpx;height: 53rpx;margin-left:6rpx;background-color: #fff;box-sizing: border-box;border-radius: 10rpx;border: 1rpx solid #363636;color: #333"
                                            class="flex align-center">
                                            <view
                                                style="width: 80rpx;height: 50rpx;line-height: 50rpx;border-right: 1rpx solid #333;background: #EEEEEE;border-radius: 10rpx 0rpx 0rpx 10rpx;margin-right: 4rpx;"
                                                class="text-center">¥</view>
                                            <input placeholder="请输入" placeholder-style="color:#363636;font-size: 32rpx;"
                                                type="number" v-model="currentItem.memberPriceNew"
                                                style="padding: 2rpx 0 2rpx 6rpx;" />
                                        </view>
                                    </view>
                                </view>
                            </view>
                            <view style="padding: 0 10rpx;box-sizing: border-box;"
                                v-if="currentItem?.specMode == '2' && isReceivePriceValue == '0'">
                                <view v-if="!!currentItem.specAttrs && typeof (currentItem.specAttrs) == 'string'"
                                    class='flex co-8e'>
                                    <view class='flex' style="flex: 2">
                                        <view v-for="spec in JSON.parse(currentItem.specAttrs)" style="flex:1">
                                            {{ spec.name }}
                                        </view>
                                    </view>
                                    <view style="flex:2">编码/条码</view>
                                    <view style="flex:2" class="text-center">价格</view>
                                </view>
                                <scroll-view scroll-y="true" style="font-size: 24rpx;margin-top: 10rpx;height: 25vh">
                                    <view>
                                        <view v-for="(a, c) in currentItem.goodsSkuList" class='flex align-center'
                                            :key="c" style="margin-bottom: 10rpx">
                                            <view class='flex' style="flex: 2">
                                                <view v-for="b in a.skuName?.split('-')" style="flex:1">{{ b }}</view>
                                            </view>
                                            <view style="flex: 2;line-height: 25rpx">
                                                <view>{{ a.goodsCode }}</view>
                                                <view>{{ a.goodsBarcode }}</view>
                                            </view>
                                            <view class="co-8e" style="font-size: 24rpx;">
                                                <view class="flex align-center"><text>门店</text>
                                                    <view class="flex align-center"
                                                        style="font-size: 32rpx;box-sizing: border-box">
                                                        <view
                                                            style="width: 210rpx;height: 53rpx;margin-left:6rpx;background-color: #fff;box-sizing: border-box;border-radius: 10rpx;border: 1rpx solid #363636;color: #333"
                                                            class="flex align-center">
                                                            <view
                                                                style="width: 80rpx;height: 50rpx;line-height: 50rpx;border-right: 1rpx solid #333;background: #EEEEEE;border-radius: 10rpx 0rpx 0rpx 10rpx;margin-right: 4rpx;"
                                                                class="text-center">¥</view>
                                                            <input placeholder="请输入"
                                                                placeholder-style="color:#363636;font-size: 32rpx;"
                                                                type="number" v-model="a.storePriceNew"
                                                                style="padding: 2rpx 0 2rpx 6rpx;" />
                                                        </view>
                                                    </view>
                                                </view>
                                                <view class="flex align-center" style="font-size: 24rpx"><text>会员</text>
                                                    <view class="flex align-center"
                                                        style="font-size: 32rpx;box-sizing: border-box">
                                                        <view
                                                            style="width: 210rpx;height: 53rpx;margin-left:6rpx;background-color: #fff;box-sizing: border-box;border-radius: 10rpx;border: 1rpx solid #363636;color: #333"
                                                            class="flex align-center">
                                                            <view
                                                                style="width: 80rpx;height: 50rpx;line-height: 50rpx;border-right: 1rpx solid #333;background: #EEEEEE;border-radius: 10rpx 0rpx 0rpx 10rpx;margin-right: 4rpx;"
                                                                class="text-center">¥</view>
                                                            <input placeholder="请输入"
                                                                placeholder-style="color:#363636;font-size: 32rpx;"
                                                                type="number" v-model="a.memberPriceNew"
                                                                style="padding: 2rpx 0 2rpx 6rpx;" />
                                                        </view>
                                                    </view>
                                                </view>
                                            </view>
                                        </view>
                                    </view>
                                </scroll-view>
                            </view>
                        </view>
                    </view>
                    <view class="bottom-1">
                        <eui-button type="max" title="确定" style="width: 80%;height: 100%;line-height: 78rpx;padding: 0;"
                            @buttonClick="priceUpdateConfirm" />
                    </view>
                </view>
            </eui-popup>
        </view>
    </view>
</template>
<script setup type="ts">
import { ref, reactive, onMounted, onUnmounted } from 'vue';
import { cloneDeep } from 'lodash';
import service from '@/common/service';
import { getBcmUrl, bcmRequest } from '../../../hooks/bcmServices';
import { getBcmDictLists, getBcmDictList, getBcmDictName, getBcmDictItem, formatPrice, formatSkuPrice } from '../../../hooks/bcmUseUntils';
import { onLoad, onShow } from "@dcloudio/uni-app";
import { useMainStore } from "@/store/modules/store";
import { init, onClickRefresh } from '../../../hooks/bcmInit';
import Enjoy from "../../../common/enjoy"
import BcmEventType from "@/pages/BcmViews/common/BcmEventType";
import { storeToRefs } from 'pinia';
import { useThemeStore } from '@/store/themeStore';
import BcmCloseBtn from '../components/BcmCloseBtn.vue';
import GoodsItem from './components/GoodsItem.vue';
import NextTree from '../components/BcmTree/index.vue';
import transformArrayToTree from '@/pages/BcmViews/utils/transformArrayToTree.ts'

const themeStore = useThemeStore(); // 主题
const { theme } = storeToRefs(themeStore);
const themeColor = ref(theme._object.theme == 'theme-blue' ? '#7BDAF2' : '#FF6430')

const mainStore = useMainStore();
const { loginInfo } = mainStore;
const bcmUrl = getBcmUrl();

const BcmNavBar = ref(null);
const sUserStore = ref('');
const sUserStoreName = ref('');
const sUser = ref('');

const CurrentPage = ref(1); //第几页
const PageSize = ref(10); //每页10条
const RowsCount = ref(0); //总条数
const PageCount = ref(1); //总页数

const orderList = ref([]);
const stockLogList = ref([]);
const chnlStockLogList = ref([]);
const chnlTypeList = ref([]);
const shelvesStatusList = ref([]);
const isReceivePriceList = ref([]);
const isReceiveStockList = ref([]);
const stockoutStatusList = ref([]);
const onlineSaleStatusList = ref([]);
const currentItem = ref(null);
const currentSkuItem = ref(null);

const searchValue = ref('');
const searchText = ref('');
const cateCode = ref('');
const cateName = ref('全部');

const shelvesPop = ref(false);
const shelvesType = ref('0')
const shelvesStatusValue = ref('1')
const chnlShelvesStatusValue = ref(null)

const moreActionPop = ref(false);
const modifyStockPop = ref(false);
const stockLogPop = ref(false);
const stockSyncLogPop = ref(false);
const chooseSkuPop = ref(false);
const modifyPricePop = ref(false);
const isReceiveStockValue = ref('1');
const isReceivePriceValue = ref('1');

const cateTreeData = ref(null)

const changeType = () => {
    shelvesType.value = shelvesType.value == '0' ? '1' : '0';
}

const radioChange = function (evt) {
    shelvesStatusValue.value = evt.detail.value
}

const stockStatusRadioChange = function (evt) {
    isReceiveStockValue.value = evt.detail.value
}

const selectItem = function (item) {
    cateCode.value = item?.id;
    cateName.value = item?.name;
    fetchOrderData()
}

const priceStatusRadioChange = function (evt) {
    isReceivePriceValue.value = evt.detail.value;
    if (evt.detail.value == '0') {
        if (currentItem.value.specMode != '2') {
            currentItem.value.storePriceNew = currentItem.value.storePrice?.toFixed(2);
            currentItem.value.memberPriceNew = currentItem.value.memberPrice?.toFixed(2);
        } else {
            currentItem.value?.goodsSkuList?.map(v => {
                v.storePriceNew = v.storePrice?.toFixed(2) || 0;
                v.memberPriceNew = v.memberPrice?.toFixed(2) || 0;
            })
        }
    }
}

const chnlRadioChange = function (evt) {
    chnlShelvesStatusValue.value[evt.target.dataset.chnltype] = evt.detail.value;
}

const dropDownData = ref([{
    title: '筛选',
    type: 'filter',
    children: [{
        title: "上架状态",
        type: 'radio',
        dataIndex: 'shelvesStatus',
        value: null,
        options: [{
            label: "全部",
            value: null
        }]
    }, {
        title: "售卖渠道",
        type: 'radio',
        dataIndex: 'chnlType',
        value: null,
        options: [{
            label: "全部",
            value: null
        }]
    }, {
        title: "价格状态",
        type: 'radio',
        dataIndex: 'isReceivePrice',
        value: null,
        options: [{
            label: "全部",
            value: null
        }]
    }, {
        title: "库存状态",
        type: 'radio',
        dataIndex: 'isReceiveStock',
        value: null,
        options: [{
            label: "全部",
            value: null
        }]
    }, {
        title: "缺货状态",
        type: 'radio',
        dataIndex: 'stockoutStatus',
        value: null,
        options: [{
            label: "全部",
            value: null
        }]
    }]
}])

const getTreeData = async () => {
    const req = {
        IsNotPage: true,
        OrderColumn: 'cateSort',
        SortType: 'ASC'
    }
    const ret = await bcmRequest(bcmUrl.managerApi, '商品分类表', 'EnjoyQueryList', req);
    let arr = ret?.ReturnObject || [];
    arr.unshift({
        cateCode: "",
        cateId: "",
        cateLevel: 1,
        cateName: "全部商品",
        cateSort: 1,
        cateSyncStatus: "2",
        childrenList: [],
        isLast: "1",
        pCateCode: "0"
    }, {
        cateCode: "-",
        cateId: "00",
        cateLevel: 1,
        cateName: "无分类",
        cateSort: 1,
        cateSyncStatus: "2",
        childrenList: [],
        isLast: "1",
        pCateCode: "0"
    })
    let dataSource = [];
    if (arr) {
        dataSource = cloneDeep(arr);
    }
    const TreeArray = transformArrayToTree(
        dataSource ? dataSource : [],
        'cateCode',
        'pCateCode',
        (item) => item?.cateName
    );

    cateTreeData.value = TreeArray;

}

const getDropdownData = async () => {
    dropDownData.value[0].children[0].options = dropDownData.value[0].children[0].options.concat(shelvesStatusList.value)
    dropDownData.value[0].children[1].options = dropDownData.value[0].children[1].options.concat(chnlTypeList.value);
    dropDownData.value[0].children[2].options = dropDownData.value[0].children[2].options.concat(isReceivePriceList.value)
    dropDownData.value[0].children[3].options = dropDownData.value[0].children[3].options.concat(isReceiveStockList.value)
    dropDownData.value[0].children[4].options = dropDownData.value[0].children[4].options.concat(stockoutStatusList.value)
}

const initDict = async () => {
    const bcmDictLists = getBcmDictLists(['shelvesStatus', 'isReceivePrice', 'isReceiveStock', 'stockoutStatus', 'onlineSaleStatus']);
    shelvesStatusList.value = bcmDictLists['shelvesStatus'];
    isReceivePriceList.value = bcmDictLists['isReceivePrice'];
    isReceiveStockList.value = bcmDictLists['isReceiveStock'];
    stockoutStatusList.value = bcmDictLists['stockoutStatus'];
    onlineSaleStatusList.value = bcmDictLists['onlineSaleStatus'];
}

const getColor = (chnlType) => {
    return getBcmDictItem('chnlType', chnlType)?.color
}

const getChnlType = async function () {
    let chnlList = [];
    const response = await bcmRequest(bcmUrl.managerApi, '渠道列表', 'SearchDistinctChannelWithType', {});
    await Promise.all(response.map(v => {
        if (getBcmDictItem('chnlType', v.chnlType)) {
            chnlList.push(getBcmDictItem('chnlType', v.chnlType))
        }
    }))
    chnlTypeList.value = chnlList;
}

const toLog = (item) => {
    if (item.specMode == '2') {
        chooseSkuPop.value.open('bottom')
    } else {
        currentSkuItem.value = item;
        getGdsStockLog(item)
    }
}

const toSkuStockLog = (item) => {
    currentSkuItem.value = item;
    getGdsStockLog(item)
}

const getGdsStockLog = async (item) => {
    let ObjectData = {
        IsNotPage: false,
        CurrentPage: 1,
        PageSize: 100,
        WhereList: [
            { c_col: "storeCode", c_oper: "等于", c_value: sUserStore.value, c_logic: "而且" },
            { c_col: "goodsCode", c_oper: "等于", c_value: item.goodsCode, c_logic: "而且" },
            { c_col: "goodsBarcode", c_oper: "等于", c_value: item.goodsBarcode, c_logic: "而且" }
        ]
    }
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.stockApi, '门店商品库存日志表', 'EnjoyQueryList', ObjectData);
    service.enjoyHideLoading();
    stockLogList.value = response.ReturnObject;
    stockLogPop.value.open('bottom')
}

const toChnlLog = async (syncId) => {
    let ObjectData = {
        IsNotPage: false,
        CurrentPage: 1,
        PageSize: 100,
        WhereList: [
            { c_col: "syncId", c_oper: "等于", c_value: syncId, c_logic: "而且" },
        ]
    }
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.stockApi, '店铺商库存日志表', 'EnjoyQueryList', ObjectData);
    service.enjoyHideLoading();
    chnlStockLogList.value = response.ReturnObject;
    stockSyncLogPop.value.open('bottom')
}

const formatShopGoodsPublishList = (record) => {
    let publishedShopGoodsList = [];
    chnlTypeList.value?.map(v => {
        let item = record.publishedShopGoodsList?.find(a => a.chnlType == v.value)
        if (!!item) {
            publishedShopGoodsList.push({
                ...item,
                chnlName: v.text,
                color: v.color
            })
        }
    })
    return publishedShopGoodsList
}

const clickScanLeft = () => {
    uni.scanCode({
        success: async function (res) {
            if (res.result != '' && res.result != undefined && res.result != null) {
                searchValue.value = res.result;
                await searchConfirm({
                    value: res.result
                });
            }
        }
    });
}

const searchConfirm = (e) => {
    searchValue.value = e.value;
    CurrentPage.value = 1;
    fetchOrderData()
}

const onConfirm = (data) => {
    let params = {};
    dropDownData.value[0].children?.map(v => {
        params[v.dataIndex] = v.value
    })
    searchText.value = params
    fetchOrderData()
};

const initDropDownParams = (params) => {
    let object = searchText.value;
    for (var keys in object) {
        if (keys) {
            params.WhereList.push({ c_col: keys, c_oper: '等于', c_value: object[keys], c_logic: "而且" })
        }
    }
    return params
}

const updateShelvesStatus = async () => {
    let shopGoodsStatusList = []
    for (var keys in chnlShelvesStatusValue.value) {
        shopGoodsStatusList.push({
            chnlType: keys,
            status: shelvesType.value == '0' ? shelvesStatusValue.value : chnlShelvesStatusValue.value[keys]
        })
    }
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.managerApi, '门店商品表', 'UpdateShelvesStatusGroupByChnl', [{
        id: currentItem.value?.storeGoodsId,
        shopGoodsStatusList
    }]);
    service.enjoyHideLoading();
    formatResponse(response)
}

const stockUpdateConfirm = async () => {
    let ObjectData;
    if (isReceiveStockValue.value == '1') {
        await handleOnStockClick()
        return
    } else {
        if (currentItem.value.specMode != '2') {
            ObjectData = {
                ids: [currentItem.value.storeGoodsStockId],
                stock: currentItem.value.stock1
            }
        } else {
            let list = [];
            await Promise.all(currentItem.value.goodsSkuList?.filter(f => (!!f.stock1 || f.stock1 == 0))?.map(f => {
                list.push({
                    id: f.storeGoodsStockSkuId,
                    stock: f.stock1
                })
            }))
            ObjectData = { list }
        }
    }

    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.stockApi, '门店商品库存表', currentItem.value.specMode != '2' ? 'StopStockAndSetStock' : 'StopStockAndSetStockItem', ObjectData);
    service.enjoyHideLoading();
    formatResponse(response)
}

const formatResponse = (response, text = '操作成功') => {
    if (response?.Flag == '1') {
        uni.showToast({
            title: text,
            icon: 'none',
            duration: 2000
        });
        setTimeout(() => {
            fetchOrderData()
            close()
        }, 500)
    } else {
        uni.showToast({
            title: response?.Msg,
            icon: 'none',
            duration: 2000
        });
    }
}

const priceUpdateConfirm = async () => {
    let ObjectData = [];
    if (currentItem.value.specMode != '2') {
        if (currentItem.value.isReceivePrice == isReceivePriceValue.value && ((currentItem.value.storePriceNew == currentItem.value.storePrice && currentItem.value.memberPrice == currentItem.value.memberPriceNew && isReceivePriceValue.value == '0') || isReceivePriceValue.value == '1')) {
            uni.showToast({
                title: '暂无改动，无需提交～',
                icon: 'none',
                duration: 2000
            });
            return false
        }
        if (currentItem.value.isReceivePrice != isReceivePriceValue.value) {
            ObjectData.push({
                isReceivePrice: isReceivePriceValue.value,
                storeGoodsId: currentItem.value.storeGoodsId,
                storePrice: currentItem.value.storePriceNew,
                memberPrice: currentItem.value.memberPriceNew
            })
        }
    } else {
        await Promise.all(currentItem.value.goodsSkuList?.map(v => {
            ObjectData.push({
                isReceivePrice: isReceivePriceValue.value,
                storeGoodsSkuId: v.storeGoodsSkuId,
                storePrice: v.storePriceNew,
                memberPrice: v.memberPriceNew
            })
        }))
    }
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.managerApi, '商品表', 'SetStoreGoods', ObjectData);
    service.enjoyHideLoading();
    formatResponse(response)
}

const handleOnPriceClick = async () => {
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.managerApi, '门店商品表', 'UpdateReceivePrice', [{
        id: currentItem.value?.storeGoodsId,
        status: currentItem.value?.isReceivePrice == '0' ? '1' : '0'
    }]);
    service.enjoyHideLoading();
    formatResponse(response)
}

const handleSyncOperate = async (type) => {
    service.enjoyShowLoading('正在处理...');
    let methodName = type == '1' ? "SyncStoreGoodsStock" : type == '2' ? "SyncStoreGoodsPrice" : type == '3' ? 'SyncStoreGoodsShelvesStatus' : '';
    const response = await bcmRequest(type == '1' ? bcmUrl.stockApi : bcmUrl.managerApi, type == '1' ? '门店商品库存表' : '门店商品表', methodName, {
        BillId: type == '1' ? currentItem.value?.storeGoodsStockId : currentItem.value?.storeGoodsId
    });
    service.enjoyHideLoading();
    formatResponse(response, '正在同步,稍后查看同步日志..')

}

const minusNum = () => {
    if (currentItem.value.stock1 > 0) {
        currentItem.value.stock1--;
    } else {
        currentItem.value.stock1 = 0;
    }
}

const minusStockNum = (index) => {
    if (currentItem.value.goodsSkuList[index]?.stock1) {
        currentItem.value.goodsSkuList[index].stock1--;
    } else {
        currentItem.value.goodsSkuList[index].stock1 = 0;
    }
}

const plusStockNum = (index) => {
    if (currentItem.value.goodsSkuList[index]?.stock1 || currentItem.value.goodsSkuList[index]?.stock1 == 0) {
        currentItem.value.goodsSkuList[index].stock1++;
    } else {
        currentItem.value.goodsSkuList[index].stock1 = 0;
        currentItem.value.goodsSkuList[index].stock1++;
    }
}

const plusNum = () => {
    if (currentItem.value.stock1 >= 0) {
        currentItem.value.stock1++;
    } else {
        currentItem.value.stock1 = 0;
    }
}

const handleOnStockClick = async () => {
    service.enjoyShowLoading('正在处理...');
    const response = await bcmRequest(bcmUrl.stockApi, '门店商品库存表', 'UpdateReceiveStock', [{
        id: currentItem.value?.storeGoodsStockId,
        status: currentItem.value?.isReceiveStock == '0' ? '1' : '0'
    }]);
    service.enjoyHideLoading();
    formatResponse(response)
}

const setDefault = () => {
    sUserStore.value = loginInfo?.sDefaultStore ? loginInfo.sDefaultStore : loginInfo.sUserStore;
    sUserStoreName.value = loginInfo?.sDefaultStoreName ? loginInfo.sDefaultStoreName : loginInfo.sUserStoreName;
    sUser.value = loginInfo.sUser;
}

// 选择框点击事件
const clickStore = () => {
    let parms = Enjoy.GetDialogParms();
    parms.CallBack = SelectionChanged;
    parms.SelectionType = "机构选择";
    parms.SelectedItems = sUserStore.value;
    Enjoy.OpenDialog(parms)
}

const SelectionChanged = (event) => {
    if (event.SelectionType == '机构选择') {
        // 更新机构信息
        sUserStoreName.value = event.BackParms.Value;
        sUserStore.value = event.BackParms.Key;
        mainStore.switchStore(event.BackParms.Type, sUserStore.value, sUserStoreName.value);
        uni.$emit(BcmEventType.SWITCH_STORE, { msg: '切换门店' })
        // 按新条件获取数据
        fetchOrderData();
    }
}
// 列表下拉刷新
const listPullDown = (e) => {
    fetchOrderData();
    // staOrderStatus();
}
// 列表上拉加载
const listPullUp = (e) => {
    if (CurrentPage.value < PageCount.value) {
        CurrentPage.value = CurrentPage.value + 1;
        fetchOrderData(true);
    }
}

const close = () => {
    shelvesPop.value.close();
    moreActionPop.value.close();
    modifyStockPop.value.close();
    modifyPricePop.value.close();
    stockLogPop.value.close();
    shelvesType.value = '0';
    shelvesStatusValue.value = '1';
    chnlShelvesStatusValue.value = null;
    currentItem.value = null;
}

const closeLog = () => {
    stockLogPop.value.close();
    stockLogList.value = [];
}

const closeSyncLog = () => {
    stockSyncLogPop.value.close();
    chnlStockLogList.value = [];
}

const closeSkuPop = () => {
    chooseSkuPop.value.close();
}

const buttonClick = (e) => {
    let { singleTag, modelValue } = e;
    currentItem.value = modelValue;
    switch (singleTag) {
        case 'shelves':
            formatShopGoodsPublishList(modelValue)?.map(v => {
                chnlShelvesStatusValue.value = {
                    ...chnlShelvesStatusValue.value,
                    [v.chnlType]: '1'
                }
            })
            shelvesPop.value.open('bottom');
            break;
        case 'shelvesConfirm':
            updateShelvesStatus()
            break;
        case 'modifyStock':
            isReceiveStockValue.value = modelValue.isReceiveStock;
            if (modelValue.specMode != '2') {
                currentItem.value.stock1 = modelValue.stock;
            } else {
                currentItem.value?.goodsSkuList?.map(v => {
                    v.stock1 = v.stock || 0;
                })
            }
            modifyStockPop.value.open('bottom');
            break;
        case 'submit':

            break;
        case 'more':
            moreActionPop.value.open('bottom');
            break;
        case 'modifyPrice':
            isReceivePriceValue.value = modelValue.isReceivePrice;
            if (modelValue.specMode != '2') {
                currentItem.value.storePriceNew = modelValue.storePrice?.toFixed(2);
                currentItem.value.memberPriceNew = modelValue.memberPrice?.toFixed(2);
            } else {
                currentItem.value?.goodsSkuList?.map(v => {
                    v.storePriceNew = v.storePrice?.toFixed(2) || 0;
                    v.memberPriceNew = v.memberPrice?.toFixed(2) || 0;
                })
            }
            modifyPricePop.value.open('bottom');
            break;
    }
}

const fetchOrderData = async (e = undefined) => {
    service.enjoyShowLoading('正在加载...');
    if (!e) {
        CurrentPage.value = 1;
    }
    let param = {
        IsNotPage: false,
        CurrentPage: CurrentPage.value,
        PageSize: PageSize.value,
        WhereList: [
            { c_col: "storeCode", c_oper: "等于", c_value: sUserStore.value, c_logic: "而且" },
            { c_col: "code", c_oper: "等于", c_value: searchValue.value, c_logic: '或者', c_left: '(', c_right: '' },
            { c_col: 'goodsName', c_oper: "等于", c_value: searchValue.value, c_logic: '或者' },
            { c_col: 'goodsCode', c_oper: "等于", c_value: searchValue.value, c_logic: '或者' },
            { c_col: 'goodsBarcode', c_oper: "等于", c_value: searchValue.value, c_logic: '而且', c_left: '', c_right: ')' },
            { c_col: "cateCode", c_oper: "等于", c_value: cateCode.value, c_logic: "而且" },
        ]
    }
    param = initDropDownParams(param);
    const response = await bcmRequest(bcmUrl.managerApi, '门店商品表', 'QueryStoreGoodsPriceStock', param);
    service.enjoyHideLoading();
    CurrentPage.value = response.CurrentPage; //第几页
    PageSize.value = response.PageSize; //每页10条
    RowsCount.value = response.RowsCount; //总条数
    PageCount.value = response.PageCount; //总页数
    if (response.CurrentPage == 1) {
        orderList.value = response.ReturnObject;
    } else {
        orderList.value = orderList.value.concat(response.ReturnObject);
    }
}

onMounted(() => {
    // chnlTypeList.value = getBcmDictList('chnlType')
})

onShow(async () => {
    if (sUserStore.value) {
        // await staOrderStatus();
        await fetchOrderData();
    }
})

onLoad(async () => {
    await init();
    await setDefault();
    await getChnlType();
    await initDict();
    await getDropdownData()
    if (!loginInfo.sUserStore) {
        BcmNavBar.value.onClickStore();
        return;
    }
    await getTreeData()
    await fetchOrderData();
})

onUnmounted(() => {

})

defineExpose({
    SelectionChanged
})
</script>
<style lang="scss" scoped>
@import "../../../main.scss";
@import "../common/common.css";

.content {
    display: flex;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
    height: 100%;

    //background-color: $uni-background;
    padding: 0;
}

.navigation {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    background: #f2f2f2;
}

.footer-view {
    display: flex;
    overflow-y: auto;
    width: 100%;
    height: 100%;
    background: $uni-bg-color;
    margin-top: 10rpx;
}

::v-deep .white-main {
    right: 0;
    left: 0;
    margin: 0 !important;
    margin-top: 10rpx !important;
}

.more-btn {
    height: 90rpx;
    line-height: 90rpx;
    border-bottom: 1rpx solid #E0E0E0;
    text-align: center;
    font-size: 32rpx;
    font-weight: bold;
}

.content-img {
    width: 100%;
    background: #fff;
}

.navigation {
    flex: 0 0 auto;
}

.footer {
    flex: 1;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

.bottom-1 {
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
    height: 78rpx;
    line-height: 78rpx;
    background: #fff;
    padding: $uni-spacing-col-sm * 2 $uni-spacing-row-sm;
}

.goods-image {
    width: 150rpx;
    height: 150rpx;
    border-radius: 4rpx;
}

.popup-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    background-color: #fff;

    .popup-title {
        display: flex;
        align-items: center;
        box-sizing: border-box;
        width: 100%;
        height: 100rpx;
        padding-right: 36rpx;
        padding-left: 30rpx;
        font-size: 33rpx;
        line-height: 100rpx;
        border-bottom: 1px solid #f1f1f1;
    }

    textarea {
        box-sizing: border-box;
        width: 100%;
        height: 80px;
        padding: 5px;
        margin: 5px 0;
        border: 1px solid #ccc;
        border-radius: 5px;
    }
}

.container {
    box-sizing: border-box;
    width: 100%;
    height: 80rpx;
    color: #000;
    font-size: 14px;
    background-color: #fff;
    border-bottom: 2rpx solid #fff;
}

.scroll-view {
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
    overflow-x: auto;
    width: 100%;
    height: 100%;
    white-space: nowrap;
}

.orderno-scroll-view {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    overflow-x: auto;
    width: 100%;
    height: 100%;
    white-space: nowrap;
}

.item {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    width: 250rpx;
    height: 80rpx;
    line-height: 80rpx;
    text-align: center;
    text-align: center;
}

.number {
    position: absolute;
    top: 0;
    right: 10rpx;
    height: 30rpx;
    padding: 2px 6px;
    color: #fff;
    font-size: 12px;
    line-height: 30rpx;
    background-color: #f00;
    border-radius: 10px;
}

.orderno {
    display: inline-block;
    box-sizing: border-box;
    width: 129rpx;
    height: 110rpx;
    margin-right: 24rpx;
    background: #eee;
    border-radius: 8rpx;
}

.active {
    background: linear-gradient(200deg, #59e3ea 0%, #197cd8 100%, #e4d48d 100%);
}

.remarkitem {
    box-sizing: border-box;
    width: 100%rpx;
    height: 110rpx;
    padding: 17rpx 0;
    border-bottom: 1rpx solid #979797;
}

.over {
    width: 114rpx;
    height: 30rpx;
    margin-left: 15rpx;
    line-height: 30rpx;
    border-radius: 0rpx 6rpx 0rpx 6rpx;
}

.remarkBox .remarkitem:nth-last-child(1) {
    border: none;
}

.text-elips {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

::v-deep .scroll-box .uni-scroll-view-content {
    background: #fff !important;
}

::v-deep .list_scroll .list_cell {
    box-sizing: border-box;
    padding: 0 0 14rpx;
    margin: 0;
    border-bottom: 1rpx solid #E0E0E0;
    border-radius: 0;
}

::v-deep .list_scroll .list_cell .item_view {
    box-sizing: border-box;
    padding: 0 10rpx;
}

::v-deep .le-dropdown-content {
    left: -85vw !important;
    width: 100vw !important;
}

::v-deep .margin.m-button {
    width: auto !important;
    padding-left: 20rpx !important;
    padding-right: 20rpx !important;
}
</style>
